#练习1---Python出现的次数
with open('./files/1file.txt','r',encoding='utf-8') as f:
    #将文件内容读取出来
    result = f.read()
    #调用字符串count方法，传入参数
    print(result.count('Python'))
print("--------------------------------------------")
#练习2
with open('./files/1file.txt','r',encoding='utf-8') as f:
    #通过read方法读取文件内容并打印
    result = f.read()
    print(result)
    #行数
    str_list = result.split('\n')
    #行数累加
    count = 0
    for line in str_list:
        count += 1
    print(f"总行数为:{count}")
#练习3
with open('./files/1file.txt','r',encoding='utf-8') as f:
    #将文件内容读取出来
    result = f.read()
    
